<template>
  <el-descriptions :column="1" class="base_descriptions_one">
    <el-descriptions-item label="头像">
      <el-image :src="data.avatar" fit="fill" />
    </el-descriptions-item>
    <el-descriptions-item label="昵称">
      {{ data.nickname }}
    </el-descriptions-item>
    <el-descriptions-item label="账号">
      {{ data.loginName }}
    </el-descriptions-item>
    <el-descriptions-item label="性别">
      {{ data.gender }}
    </el-descriptions-item>
    <el-descriptions-item label="真实姓名">
      {{ data.realName }}
    </el-descriptions-item>
    <el-descriptions-item label="身份证">
      {{ data.identityCardNumber }}
    </el-descriptions-item>
    <el-descriptions-item label="地址">
      {{ data.address }}
    </el-descriptions-item>
    <el-descriptions-item label="累计消费（元）">
      {{ data.totalPayMoney }}
    </el-descriptions-item>
    <el-descriptions-item v-if="type === 'memberdetails'" label="会员积分">
      {{ data.rewardPoints }}
    </el-descriptions-item>
    <el-descriptions-item label="创建时间">
      {{ data.createTime }}
    </el-descriptions-item>
  </el-descriptions>
</template>

<script setup>
import { ref, defineProps } from "vue";
import api from "@api/member"
import useRoute from "@util/router";

const props = defineProps({
  type: {
    type: String
  }
})

const route = useRoute();

const data = ref({})

getData()
function getData() {
  let routeQuery = route.query()
  api.details(routeQuery.code, val => {
    data.value = val
  })
}
</script>